import socket
import eventlet

def is_connected():
    try:
        # connect to the host -- tells us if the host is actually
        # reachable
        eventlet.monkey_patch()
        with eventlet.Timeout(2, False):
            socket.create_connection(("www.baidu.com", 80))
            return True
        return False
    except OSError:
        pass
    return False